/*
 * @FilePath: /etws-sxk2307/Conf/Conf.h
 * @Description:  
 * @Author: ipk518 && 18163976442@163.com
 * @Date: 2024-04-09 14:41:28
 * @LastEditors: ipk518 18163976442@163.com
 * @LastEditTime: 2024-08-29 15:50:27
 * Copyright    : G AUTOMOBILE RESEARCH INSTITUTE CO.,LTD Copyright (c) 2024.
 */
#ifndef _CONFIG_
#define _CONFIG_

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../inc/commHeader.h"

namespace Conf 
{

struct filePath final
{
    std::string uAmplitudePath;
    std::string uFreqPointPath;
    std::string uFreqReferencePath;
};

struct paramConf final
{
    int uFreqPoint;
    std::string uLmx2820Dev;
    std::string uAd9171Dev;
};

struct logConf final
{
    int uLogOut;
    int uStdOut;
    int uLogMaxSize;
    int uLogRotateCount;
    std::string uLogPath;

};

struct testConf final
{
    int uInitPl;        //初始化PL端 
    int uDarktsEnable;  //暗室测试开启标志位
    int uStartTime;     //默认开启时序 
    int uHrEnable;      //开机使能心跳 
    int uCalibAnalog;   //校准模拟使能
    int uAmpAnalog1;
    int uAmpAnalog2;
    int uPhaseAnglog1;
    int uPhaseAnglog2;
};

struct darktsCode final
{
    int uSendUpdate;
    int uReviceUpdate;
    int uSendRecvUpdate;
};

struct gpioConf final
{
    int uZynqBase;
    int uPowerUp0;
    int uPowerUp1;
    int uPowerUp2;
    int uPowerUp3;
    int uPowerPz;
    int uLedGreen;
    int uLedRed;
    int uAd9171nRST;
    int uAd9171TxEn0;
    int uAd9171TxEn1;
    int uPlRfSync;
    int uPlReset;
    int uPlPllStatus;
    int uPlAutoAlign;
    int uPlAdcInit;
    int uPlAdSync;
    
};

struct SessConf final
{
    int uHtbPort;
    std::string uHtbIp;
    std::string uLocalHtbIp;
    int uCmdPort;
    std::string uCmdIp;
    std::string uLocalCmdIp;
    int uPcPort;
    std::string uPcIp;
    std::string uLocalIp;
    int uComPort;
    std::string uComIp;
    std::string uLocalComIp; 
};

struct BeamConf final
{
    uint8_t uBeamList[36];
    uint16_t uBeamPara[130];
    uint16_t uDarktsBeamPara[130];
    uint16_t uTxBeamPara[130];
    uint16_t uRxBeamPara[130];
};

struct PhaseConf final
{
    int uWriteNum;
    uint16_t uPhaseCode[32];
};

struct ConfItem final
{
    filePath    mFilePath;
    paramConf   mParam;
    logConf     mLogConf;
    testConf    mTestConf;
    darktsCode  mDarktsCode;
    gpioConf    mGpioConf;
    SessConf    mSessConf;
    BeamConf    mBeamConf;
    PhaseConf   mPhaseConf;
};



ConfItem* currentConf();
Message loadConf(const std::string &path);

} // namespace end.

#endif